<?php
//require_once 'Slim.php';
require_once dirname(__FILE__) . '/../../lib/Slim/Slim.php';
require_once 'error.php';
require_once 'ex.php';


/**
 * Returns the content of a Post request.
 * If the request doesn't have a payload, it returns null.
 */
function getPostPayload(){
//	$request = \Slim\Slim::getInstance()->request();
global $app;
	$request = $app->request();
	return $request->getBody();
}

/**
 * Returns the JSON content of a Post request encoded as an associative array.
 * If the request doesn't have a payload, it returns null.
 */
function getPostJSONPayload(){
	$body = getPostPayload();
	if(!is_null($body))
		return  json_decode($body, TRUE);
	else 
		return null;
}
?>
